structure Parse =
struct 
  fun parse filename =
      let val file = TextIO.openIn filename
	  fun get _ = TextIO.input file
	  val lexer = Mlex.makeLexer get
	  fun printTokens () =
	      let val t = lexer()
	      in ( print (t)
		 ; print "\n"
		 ; if "EOF" = substring(t, 0, 3)
		   then ()
		   else printTokens ()
		 )
	      end
      in ( print (filename ^ "\n")
	 ; printTokens ()
	 ; TextIO.closeIn file
	 )
      end;

  fun main(_, fs) = let fun loop [] = OS.Process.success
			  | loop [f] = ( parse f
				       ; OS.Process.success
				       )
			  | loop (f::fs) = ( parse f
					   ; print "\n"
					   ; loop fs
					   )
		    in loop fs
		    end;
end

